package com.rainy.cloud.gateway.runner;

import com.rainy.cloud.gateway.route.service.RouteLoadService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.CommandLineRunner;
import org.springframework.stereotype.Component;

/**
 * @author user
 */
@Component
public class GateWayCommandLineRunner implements CommandLineRunner {

    private Logger logger = LoggerFactory.getLogger(GateWayCommandLineRunner.class);

    @Autowired
    private RouteLoadService dynamicRouteService;

    @Override
    public void run(String... args) throws Exception {
        logger.debug(">>>>>>>>>加载路由数据开始<<<<<<<<<<<<<");
        dynamicRouteService.add(dynamicRouteService.loadRoute());
        logger.debug(">>>>>>>>>加载路由数据结束<<<<<<<<<<<<<");
    }

}
